package cn.lixin.hrm.mapper;

import cn.lixin.hrm.domain.LoginUser;
import cn.lixin.hrm.domain.Permission;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface LoginUserMapper {

    @Select("select * from t_login_user where username = #{username}")
    LoginUser loadUserByUsername(String username);
    @Select("select t3.* from t_user_role t1\n" +
            "left join t_role_permission t2  on t1.role_id = t2.role_id\n" +
            "left join t_permission t3 on t2.permission_id = t3.id where t1.user_id = #{id}")
    List<Permission> getUserPermissions(Long id);
}
